﻿using System.Windows;
using DirectXMetaData;

namespace EffectEd
{
    /// <summary>
    /// Interaction logic for Settings.xaml
    /// </summary>
    public partial class SettingsDialog : Window
    {

        public SettingsDialog()
        {
            InitializeComponent();
        }

        public void Initialize(CodeAssistance codeAssistance)
        {
            compilerSettingsControl1.Initialize(codeAssistance);
        }

        public void SetSettings(Settings settings)
        {
            checkBoxSaveOnClose.IsChecked = settings.AlwaysSaveOnClose;
            checkBoxShowLineNumbers.IsChecked = settings.ShowLineNumbers;
            compilerSettingsControl1.SetCompilerSettings(settings.DefaultCompilerSettings);
        }

        public Settings GetSettings()
        {
            return new Settings()
                       {
                           ShowLineNumbers = checkBoxShowLineNumbers.IsChecked.Value,
                           AlwaysSaveOnClose = checkBoxSaveOnClose.IsChecked.Value,
                           DefaultCompilerSettings = compilerSettingsControl1.GetCompilerSettings()
                       };
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }
    }
}
